<template>
	<view class="being">
		<view class="content">
			<view class="top" :style="{'padding-top': paddingTop}">
				<uni-icons @click="toBackPage" style="margin-left: 30rpx;width: 50rpx;" type="left" size="25"
					color="#2c2c2c">
				</uni-icons>
				<view style="display: flex;flex-direction: row;text-align:center;width: 150rpx;margin-left: 220rpx;">
					全部浪屿</view>
			</view>

			<view class="search">
				<uni-icons type="search" size="25" color="#2c2c2c"></uni-icons>
				<input @blur="pageIsland" style="width:570rpx" placeholder="请输入浪屿名称或描述关键词" v-model="queryInput.name" />
			</view>

			<view class="island-list">
				<view v-for="(island,index) in islandList" @click="goIslandEnjoy(island.id,island.type)" class="island" >
					<view class="cover" v-if="island.id">
						<image mode="aspectFill" :src="island.background"></image>
					</view>
					<view class="info">
						<view class="name">{{island.name}}</view>
						<view class="description">{{island.description}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	import SwipperTest from '@/components/Xsuu-swiper.vue'
	import TopCard from '@/components/top-card.vue'
	export default {
		components: {
			SwipperTest,TopCard
		},
		data() {
			return {

				queryInput: {
					pageNow: 1,
					pageSize: 20,
					total: 0,
					name: "",
					isIn:true
				},
				islandList: [],
				paddingTop: null

			}
		},
		onLoad() {
			this.pageIsland()
		},
		onShow() {
			this.pageIsland()
		},
		onReachBottom() {
			this.queryInput.pageNow++
			this.$api.pageCourseProgress(this.queryInput).then(res => {
				this.courseList = [...this.islandList, ...res.data.rows]
			})
		},
		methods: {
			pageIsland() {
				this.queryInput.pageNow = 1
				this.$api.pageIsland(this.queryInput).then(res => {
					this.islandList = res.data.rows
					this.queryInput.total = res.data.totalPage
				})
			},

			toBackPage(){
				uni.navigateBack()
			},


			goIslandEnjoy(islandId, type) {

				if (type == 0) {
					uni.navigateTo({
						url: '/pages_being/island/memory-island-detail?islandId=' + islandId
					})
				}
				if (type == 1) {
					uni.navigateTo({
						url: '/pages_being/island/post-island-detail?islandId=' + islandId
					})
				}
				if (type == 2) {
					uni.navigateTo({
						url: '/pages_being/island/article-island-detail?islandId=' + islandId
					})
				}

			},
		}
	}
</script>

<style scoped lang="scss">
	.being {
		background-color: #F9F9F9;
		min-height: 100vh;

		.content {
			display: flex;
			flex-direction: column;

			.top {
				width: 100%;
				height: 50rpx;
				//#ifdef MP-WEIXIN
				width: 550rpx;
				//#endif

				padding-top: 100rpx;

				// #ifdef H5
				padding-top: 40rpx;
				// #endif

				padding-bottom: 20rpx;

				display: flex;
				flex-direction: row;
				align-items: center;
				box-shadow: 1px 1px 8px 2px #f0f0f0;
			}

			.search {
				height: 80rpx;
				width: 650rpx;
				margin: 30rpx 0 30rpx 30rpx;
				background-color: #FFFFFF;
				box-shadow: 1px 1px 8px 2px #f0f0f0;
				border-radius: 20rpx;

				padding: 0 20rpx;

				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;


			}

			.island-list {

				width: 690rpx;
				margin-left: 30rpx;
				margin-bottom: 40rpx;
				display: flex;
				flex-direction: column;


				.island {
					width: 650rpx;
					padding: 20rpx;
					height: 180rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;

					margin-bottom: 30rpx;
					border-radius: 10rpx;

					background-color: #FFFFFF;
					// box-shadow: 0 0 4px 1px #f0f4f0;

					.cover {
						width: 300rpx;
						height: 180rpx;
						border-radius: 10rpx;
						overflow: hidden;
						margin-bottom: 10rpx;
					}

					.info {
						width: 330rpx;
						height: 170rpx;
						display: flex;
						flex-direction: column;
						justify-content: space-between;


						.name {
							font-size: 34rpx;
						}

						.description {
							font-size: 28rpx;
							color: gray;

							/*超过范围进行隐藏不显示*/
							overflow: hidden;
							/*文本溢出, 使用省略号 */
							text-overflow: ellipsis;
							/* 以webkit盒子展示, 比较适用于webkit内核和移动端*/
							display: -webkit-box;
							/*限制块容器显示的文本行数, 按照你的需求设置*/
							-webkit-line-clamp: 2;
							/*盒子的方向, 垂直、水平等*/
							-webkit-box-orient: vertical;
							/*文字换行, 可以在单词内断*/
							word-wrap: break-word;
						}

					}

				}
			}

		}

	}


	img {
		width: 100%;
		height: 100%;
	}

	image{
		width: 100%;
		height: 100%;
	}
</style>
